package com.baiduspring.vo;

import com.baiduspring.utils.string.StringUtils;
import com.hankcs.hanlp.HanLP;
import lombok.Data;

@Data
public class SearchResultsVO {
    private String id;
    private String title;
    private String content;
    private String contentTxt;
    private Long authorAccount;
    private Long uriMark;

    public String summary() {
        StringBuilder builder = new StringBuilder();
        HanLP.extractSummary(this.getContentTxt(), 12).forEach(s -> builder.append(s).append("，"));
        builder.deleteCharAt(builder.lastIndexOf("，"));

        return StringUtils.delHTMLTag(builder.toString())
                .replace("<", "")
                .replace(">", "");
    }
}
